# @Author: Minyan Lu
# @Email:  lminyan@outlook.com
# @Timestamp for Creation: 2021-05-22 00:44:12
# @Last Modified by:   Minyan Lu
# @Last Modified time: 2022-10-14 21:36:11


# FOXP3 rs2232365 A G

# Dominant model forest

library("meta")

setwd("/Users/hush/Documents/Project/Xiaoqin_Yang/FOXP3/3_Statistical_Analysis/rs2232365/Fig/dominant model")
Dom<-read.csv(file="/Users/hush/Documents/Project/Xiaoqin_Yang/FOXP3/3_Statistical_Analysis/rs2232365/Table/rs2232365.csv",header=TRUE,dec=".")

event.e<-Dom$AG_GG_case
n.e<-Dom$AG_GG_case+Dom$AA_case
event.c<-Dom$AG_GG_control
n.c<-Dom$AG_GG_control+Dom$AA_control

meta1<-metabin(event.e,n.e,event.c,n.c,data=Dom,
	method="MH",sm="OR",
	comb.fixed=TRUE,comb.random=TRUE,
	studlab=paste(Dom$Author,Dom$Year))
# byvar=Dom$Ethnicity,

YourFileName<-paste("Dominant model forest.PDF")
pdf(file=YourFileName,height=4.5,width=10)

forest(meta1,lab.e="PE",lab.c="Control")

dev.off()

# Dominant model sensetivity_analysis

YourFileName<-paste("Dominant model sensetivity_analysis_random.PDF")
pdf(file=YourFileName,height=3.5,width=7)

forest(metainf(meta1,pooled="random"),lab.e="PE",lab.c="Control")

dev.off()

# Dominant model funnel

YourFileName<-paste("Dominant model funnel.PDF")
pdf(file=YourFileName,height=8,width=8)

funnel(meta1)

dev.off()

# Dominant model galbraith

YourFileName<-paste("Dominant model galbraith.PDF")
pdf(file=YourFileName,height=8,width=8)

radial(meta1,level=0.95)
# radial(meta1,text=Dom$Author,level=0.95)

dev.off()

# Dominant model subgroup_analysis_Ethnicity forest

YourFileName<-paste("Dominant model subgroup_analysis_Ethnicity.PDF")
pdf(file=YourFileName,height=5.5,width=10)

meta1<-metabin(event.e,n.e,event.c,n.c,data=Dom,
	method="MH",sm="OR",byvar=Dom$Ethnicity,
	comb.fixed=TRUE,comb.random=TRUE,
	studlab=paste(Dom$Author,Dom$Year))

forest(meta1,lab.e="PE",lab.c="Control")

dev.off()

# Dominant model subgroup_analysis_samplesize forest

YourFileName<-paste("Dominant model subgroup_analysis_samplesize.PDF")
pdf(file=YourFileName,height=5.5,width=10)

meta1<-metabin(event.e,n.e,event.c,n.c,data=Dom,
	method="MH",sm="OR",byvar=Dom$samplesize,
	comb.fixed=TRUE,comb.random=TRUE,
	studlab=paste(Dom$Author,Dom$Year))

forest(meta1,lab.e="PE",lab.c="Control")

dev.off()

# Dominant model subgroup_analysis_HWE forest

YourFileName<-paste("Dominant model subgroup_analysis_HWE.PDF")
pdf(file=YourFileName,height=5.5,width=10)

meta1<-metabin(event.e,n.e,event.c,n.c,data=Dom,
	method="MH",sm="OR",byvar=Dom$HWE,
	comb.fixed=TRUE,comb.random=TRUE,
	studlab=paste(Dom$Author,Dom$Year))

forest(meta1,lab.e="PE",lab.c="Control")

dev.off()








# Heterozygote model forest

library("meta")

setwd("/Users/hush/Documents/Project/Xiaoqin_Yang/FOXP3/3_Statistical_Analysis/rs2232365/Fig/heterozygote model")
Het<-read.csv(file="/Users/hush/Documents/Project/Xiaoqin_Yang/FOXP3/3_Statistical_Analysis/rs2232365/Table/rs2232365.csv",header=TRUE,dec=".")

event.e<-Het$AG_case
n.e<-Het$AG_case+Het$AA_case
event.c<-Het$AG_control
n.c<-Het$AG_control+Het$AA_control

meta1<-metabin(event.e,n.e,event.c,n.c,data=Het,
	method="MH",sm="OR",
	comb.fixed=TRUE,comb.random=TRUE,
	studlab=paste(Het$Author,Het$Year))
# byvar=Het$Ethnicity,

YourFileName<-paste("Heterozygote model forest.PDF")
pdf(file=YourFileName,height=4.5,width=10)

forest(meta1,lab.e="PE",lab.c="Control")

dev.off()

# Heterozygote model sensetivity_analysis

YourFileName<-paste("Heterozygote model sensetivity_analysis_random.PDF")
pdf(file=YourFileName,height=3.5,width=7)

forest(metainf(meta1,pooled="random"),lab.e="PE",lab.c="Control")

dev.off()

# Heterozygote model funnel

YourFileName<-paste("Heterozygote model funnel.PDF")
pdf(file=YourFileName,height=8,width=8)

funnel(meta1)

dev.off()

# Heterozygote model galbraith

YourFileName<-paste("Heterozygote model galbraith.PDF")
pdf(file=YourFileName,height=8,width=8)

radial(meta1,level=0.95)
# radial(meta1,text=Dom$Author,level=0.95)

dev.off()

# Heterozygote model subgroup_analysis_Ethnicity forest

YourFileName<-paste("Heterozygote model subgroup_analysis_Ethnicity.PDF")
pdf(file=YourFileName,height=5.5,width=10)

meta1<-metabin(event.e,n.e,event.c,n.c,data=Het,
	method="MH",sm="OR",byvar=Het$Ethnicity,
	comb.fixed=TRUE,comb.random=TRUE,
	studlab=paste(Het$Author,Het$Year))

forest(meta1,lab.e="PE",lab.c="Control")

dev.off()

# Heterozygote model subgroup_analysis_samplesize forest

YourFileName<-paste("Heterozygote model subgroup_analysis_samplesize.PDF")
pdf(file=YourFileName,height=5.5,width=10)

meta1<-metabin(event.e,n.e,event.c,n.c,data=Het,
	method="MH",sm="OR",byvar=Het$samplesize,
	comb.fixed=TRUE,comb.random=TRUE,
	studlab=paste(Het$Author,Het$Year))

forest(meta1,lab.e="PE",lab.c="Control")

dev.off()

# Heterozygote model subgroup_analysis_HWE forest

YourFileName<-paste("Heterozygote model subgroup_analysis_HWE.PDF")
pdf(file=YourFileName,height=5.5,width=10)

meta1<-metabin(event.e,n.e,event.c,n.c,data=Het,
	method="MH",sm="OR",byvar=Het$HWE,
	comb.fixed=TRUE,comb.random=TRUE,
	studlab=paste(Het$Author,Het$Year))

forest(meta1,lab.e="PE",lab.c="Control")

dev.off()








# Homozygote model forest

library("meta")

setwd("/Users/hush/Documents/Project/Xiaoqin_Yang/FOXP3/3_Statistical_Analysis/rs2232365/Fig/homozygote model")
Hom<-read.csv(file="/Users/hush/Documents/Project/Xiaoqin_Yang/FOXP3/3_Statistical_Analysis/rs2232365/Table/rs2232365.csv",header=TRUE,dec=".")

event.e<-Hom$GG_case
n.e<-Hom$GG_case+Hom$AA_case
event.c<-Hom$GG_control
n.c<-Hom$GG_control+Hom$AA_control

meta1<-metabin(event.e,n.e,event.c,n.c,data=Hom,
	method="MH",sm="OR",
	comb.fixed=TRUE,comb.random=TRUE,
	studlab=paste(Hom$Author,Hom$Year))
# byvar=Hom$Ethnicity,

YourFileName<-paste("Homozygote model forest.PDF")
pdf(file=YourFileName,height=4.5,width=10)

forest(meta1,lab.e="PE",lab.c="Control")

dev.off()

# Homozygote model sensetivity_analysis

YourFileName<-paste("Homozygote model sensetivity_analysis_random.PDF")
pdf(file=YourFileName,height=3.5,width=7)

forest(metainf(meta1,pooled="random"),lab.e="PE",lab.c="Control")

dev.off()

# Homozygote model funnel

YourFileName<-paste("Homozygote model funnel.PDF")
pdf(file=YourFileName,height=8,width=8)

funnel(meta1)

dev.off()

# Homozygote model subgroup_analysis_Ethnicity forest

YourFileName<-paste("Homozygote model subgroup_analysis_Ethnicity.PDF")
pdf(file=YourFileName,height=5.5,width=10)

meta1<-metabin(event.e,n.e,event.c,n.c,data=Hom,
	method="MH",sm="OR",byvar=Hom$Ethnicity,
	comb.fixed=TRUE,comb.random=TRUE,
	studlab=paste(Hom$Author,Hom$Year))

forest(meta1,lab.e="PE",lab.c="Control")

dev.off()

# Homozygote model subgroup_analysis_samplesize forest

YourFileName<-paste("Homozygote model subgroup_analysis_samplesize.PDF")
pdf(file=YourFileName,height=5.5,width=10)

meta1<-metabin(event.e,n.e,event.c,n.c,data=Hom,
	method="MH",sm="OR",byvar=Hom$samplesize,
	comb.fixed=TRUE,comb.random=TRUE,
	studlab=paste(Hom$Author,Hom$Year))

forest(meta1,lab.e="PE",lab.c="Control")

dev.off()

# Homozygote model subgroup_analysis_HWE forest

YourFileName<-paste("Homozygote model subgroup_analysis_HWE.PDF")
pdf(file=YourFileName,height=5.5,width=10)

meta1<-metabin(event.e,n.e,event.c,n.c,data=Hom,
	method="MH",sm="OR",byvar=Hom$HWE,
	comb.fixed=TRUE,comb.random=TRUE,
	studlab=paste(Hom$Author,Hom$Year))

forest(meta1,lab.e="PE",lab.c="Control")

dev.off()








# Recessive model forest

library("meta")

setwd("/Users/hush/Documents/Project/Xiaoqin_Yang/FOXP3/3_Statistical_Analysis/rs2232365/Fig/recessive model")
Rec<-read.csv(file="/Users/hush/Documents/Project/Xiaoqin_Yang/FOXP3/3_Statistical_Analysis/rs2232365/Table/rs2232365.csv",header=TRUE,dec=".")

event.e<-Rec$GG_case
n.e<-Rec$GG_case+Rec$AA_AG_case
event.c<-Rec$GG_control
n.c<-Rec$GG_control+Rec$AA_AG_control

meta1<-metabin(event.e,n.e,event.c,n.c,data=Rec,
	method="MH",sm="OR",
	comb.fixed=TRUE,comb.random=TRUE,
	studlab=paste(Rec$Author,Rec$Year))
# byvar=Rec$Ethnicity,

YourFileName<-paste("Recessive model forest.PDF")
pdf(file=YourFileName,height=4.5,width=10)

forest(meta1,lab.e="PE",lab.c="Control")

dev.off()

# Recessive model sensetivity_analysis

YourFileName<-paste("Recessive model sensetivity_analysis_random.PDF")
pdf(file=YourFileName,height=3.5,width=7)

forest(metainf(meta1,pooled="random"),lab.e="PE",lab.c="Control")

dev.off()

# Recessive model funnel

YourFileName<-paste("Recessive model funnel.PDF")
pdf(file=YourFileName,height=8,width=8)

funnel(meta1)

dev.off()

# Recessive model galbraith

YourFileName<-paste("Recessive model galbraith.PDF")
pdf(file=YourFileName,height=8,width=8)

radial(meta1,level=0.95)
# radial(meta1,text=Dom$Author,level=0.95)

dev.off()

# Recessive model subgroup_analysis_Ethnicity forest

YourFileName<-paste("Recessive model subgroup_analysis_Ethnicity.PDF")
pdf(file=YourFileName,height=5.5,width=10)

meta1<-metabin(event.e,n.e,event.c,n.c,data=Rec,
	method="MH",sm="OR",byvar=Rec$Ethnicity,
	comb.fixed=TRUE,comb.random=TRUE,
	studlab=paste(Rec$Author,Rec$Year))

forest(meta1,lab.e="PE",lab.c="Control")

dev.off()

# Recessive model subgroup_analysis_samplesize forest

YourFileName<-paste("Recessive model subgroup_analysis_samplesize.PDF")
pdf(file=YourFileName,height=5.5,width=10)

meta1<-metabin(event.e,n.e,event.c,n.c,data=Rec,
	method="MH",sm="OR",byvar=Rec$samplesize,
	comb.fixed=TRUE,comb.random=TRUE,
	studlab=paste(Rec$Author,Rec$Year))

forest(meta1,lab.e="PE",lab.c="Control")

dev.off()

# Recessive model subgroup_analysis_HWE forest

YourFileName<-paste("Recessive model subgroup_analysis_HWE.PDF")
pdf(file=YourFileName,height=5.5,width=10)

meta1<-metabin(event.e,n.e,event.c,n.c,data=Rec,
	method="MH",sm="OR",byvar=Rec$HWE,
	comb.fixed=TRUE,comb.random=TRUE,
	studlab=paste(Rec$Author,Rec$Year))

forest(meta1,lab.e="PE",lab.c="Control")

dev.off()






